<template>
  <div class="allorder">
    <div class="header">
      <span class="title">我的订单</span>
    </div>
    <div class="header-a"></div>
    <div class="radio-wrap">
      <div class="radio-group">
        <span
          v-for="(tab ,index) in tabs"
          :key="tab.index"
          :class="{cur:iscur==index}"
          @click="iscur=index,tabChange('select' + (index))"
        >{{tab.name}}</span>
      </div>
      <div style="margin:10px 0;"></div>
      <keep-alive>
        <component v-bind:is="tabView"></component>
      </keep-alive>
    </div>
  </div>
</template>

<script>
// 引入子组件
// import select0 from "./All"
import select0 from "../../Manchildren/Aftersale";
import select4 from "../../Manchildren/Aftersale";
import select1 from "./Paymonney";
import select2 from "../../Manchildren/Receiving";
import select3 from "../../Manchildren/Evaluate";
export default {
  name: "allorder",
  data() {
    return {
      tabView: "select1",
      iscur: 0,
      tabs: [
        { name: "全部" },
        { name: "待付款" },
        { name: "已付款" },
        { name: "已取消" }
      ]
    };
  },
  components: {
    // 声明子组件
    select1,
    select2,
    select3,
    select4,
     select0
  },

  mounted() {
    // this.iscur=this.$route.query.index
   
    if (this.$route.query.id < 3) {
      this.iscur = this.$route.query.id + 1;
      this.tabView = "select" + this.iscur;
    }
    if (this.$route.query.id > 2) {
      this.tabView = "select" + 0;
    }
    //  if(this.$route.query.orderId==0){
    //    this.iscur=this.$route.query.orderId
    //  }

    console.log(this.tabView, this.$route.query.id);
  },
  methods: {
    tabChange: function(tab) {
      this.tabView = tab;
      if (this.tabView == select4) {
        console.log("aa");
        tab.name = "全部";
      }
    },
  }
};
</script>

<style lang='less' scoped>
@import "../../../less/allorder.less";
</style>
